<?php
namespace app\wap\controller;

use app\BaseController;

use app\wap\model\Queue;
use think\facade\Session;
use think\cache\driver\Redis;
use think\facade\Cache;

class Studyredis extends BaseController
{

    // 测试队列
    public function index(){
        $redis =  new Redis();
        $redis -> connect("127.0.0.1", "6379");

        // 方法1
        $redis -> set("study", 1);
        echo $redis->get("study");
        echo "<br/>";


        // 方法2
        $redis_cache = Cache::store('redis');
        $redis_cache -> set('name1', 'mike66');
        echo $redis_cache -> get('name1', 'mike66');
        echo "<br/>";

        // 存储数组
        $data = ['id'=>1, 'name'=>'mike1', 'age'=>18];
        $redis_cache -> set('list', $data);
    }





}
